//
//  shareViewController.m
//  翻转效果
//
//  Created by Lucifer on 15-5-18.
//  Copyright (c) 2015年 xuxzhou. All rights reserved.
//

#import "shareViewController.h"

@interface shareViewController ()
@end

@implementation shareViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    _shareView = [[UIView alloc] initWithFrame: CGRectMake( 0 , CGRectGetHeight( [[UIScreen mainScreen] bounds] ) , self.view.frame.size.width , 160 )];
    _shareView.backgroundColor = [UIColor clearColor];
    
    UIView *buttonsView = [[UIView alloc] initWithFrame: CGRectMake( 5 , 5 , _shareView.frame.size.width - 10 , _shareView.frame.size.height - 60 )];
    buttonsView.layer.cornerRadius = 5;
    buttonsView.backgroundColor = [UIColor whiteColor];
    UIButton   * shareButton=[UIButton buttonWithType:UIButtonTypeContactAdd];
    shareButton.frame=CGRectMake(100, 20, 40, 40);
    [shareButton addTarget:self action:@selector(buttonCiclked) forControlEvents:UIControlEventTouchUpInside];
    [buttonsView addSubview:shareButton];
    [_shareView addSubview: buttonsView];
    [self.view addSubview: _shareView];
}

-(void) dismissSelfAnimated: (BOOL) animated{
    [UIView animateWithDuration: 0.5 animations: ^{
        _shareView.frame = CGRectMake( 0 , CGRectGetHeight( [[UIScreen mainScreen] bounds] ) , CGRectGetWidth( [[UIScreen mainScreen] bounds] ) , 160 );
        self.view.backgroundColor = [UIColor clearColor];
    }                completion: ^(BOOL finished){
        [self.view removeFromSuperview];
    }];
}

-(void)buttonCiclked{ 
    [self dismissSelfAnimated:YES];
}
-(void) showSharePageWithComplete{
    UIWindow *window = [UIApplication sharedApplication].keyWindow;
    [window addSubview: self.view];
    [UIView animateWithDuration: 0.5 animations: ^{
        _shareView.frame = CGRectMake( 0 , CGRectGetHeight( [[UIScreen mainScreen] bounds] ) - 160 , CGRectGetWidth( [[UIScreen mainScreen] bounds] ) , 160 );
        self.view.backgroundColor = [UIColor colorWithWhite: 0.5 alpha: 0.5];
    }                completion: ^(BOOL finished){
        
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
